//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Query Application Block
//===============================================================================

using System.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;

namespace EntLibContrib.Query.Configuration
{
	/// <summary>
	/// Configuration data defining <see cref="ParameterSetData"/>. This configuration section defines the name and type
	/// of the <see cref="IParameterSet"/> class
	/// </summary>
	[Assembler(typeof(ParameterSetAssembler))]
	public sealed class ParameterSetData : NameTypeConfigurationElement
	{
		#region Constants
		private const string parametersProperty = "parameters";
		#endregion

		#region Properties
		/// <summary>
		/// Gets or sets the list of parameters associated with
		/// the query.
		/// </summary>
		/// <value>A collection of <see cref="ParameterData"/>.</value>
		[ConfigurationProperty(parametersProperty, IsRequired = false)]
		public NameTypeConfigurationElementCollection<ParameterData, CustomParameterData> Parameters
		{
			get
			{
				return (NameTypeConfigurationElementCollection<ParameterData, CustomParameterData>)base[parametersProperty];
			}
		}
		#endregion

		#region Construction
		/// <summary>
		/// Initializes a new instance of the <see cref="ParameterSetData"/> class.
		/// </summary>
		public ParameterSetData ()
		{
		}

		/// <summary>
		/// Initialize a new instance of the <see cref="ParameterSetData"/> class with a name and the type of <see cref="IParameterSet"/>.
		/// </summary>
		/// <param name="name">The name of the configured <see cref="IParameterSet"/>.</param>
		public ParameterSetData(string name)
			: base(name, typeof(ParameterSet))
		{
		}
		#endregion
	}
}